package org.mspring.platform.web.freemarker.widget.config;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Gao Youbo
 * @since 2012-12-5
 */
public class WidgetConfig implements Serializable {

    private static final long serialVersionUID = 2906413277413721401L;
    private String name;
    private String path;
    private boolean cache = true;
    private long ttl;
    private String title;
    private String description;

    private Map<String, Object> preferences = new HashMap<>();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public boolean isCache() {
        return cache;
    }

    public void setCache(boolean cache) {
        this.cache = cache;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Map<String, Object> getPreferences() {
        return preferences;
    }

    public void setPreferences(Map<String, Object> preferences) {
        this.preferences = preferences;
    }

    public long getTtl() {
        return ttl;
    }

    public void setTtl(long ttl) {
        this.ttl = ttl;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        sb.append("name:").append(name);
        sb.append(" | ");
        sb.append("path:").append(path);
        sb.append(" | ");
        sb.append("cache:").append(cache);
        sb.append(" | ");
        sb.append("ttl:").append(ttl);
        sb.append("}");
        return sb.toString();
    }

}
